# -*- mode: python ; coding: utf-8 -*-

from PyInstaller.utils.hooks import collect_all, collect_submodules

# 数据文件
datas = [
    ('D:\\Pycham\\Python\\nn\\.venv\\Lib\\site-packages\\paddleocr\\tools', 'paddleocr/tools'),
    ('monitor.py', '.'),
    ('fox.ico', '.')
]

# 二进制文件
binaries = []

# 隐式导入的模块
hiddenimports = [
    'pyclipper',
    'apted',
    'skimage',
    'skimage.morphology',
    'imgaug'  # 添加 imgaug 模块
]

# 收集 scikit-image 及其所有子模块
hiddenimports += collect_submodules('skimage')

# 收集 imgaug 及其所有子模块
hiddenimports += collect_submodules('imgaug')

   # 收集 paddleocr 模块及其所有子模块
tmp_ret = collect_all('paddleocr')
datas += tmp_ret[0]
binaries += tmp_ret[1]
hiddenimports += tmp_ret[2]

   # 收集 paddle 模块及其所有子模块
tmp_ret = collect_all('paddle')
datas += tmp_ret[0]
binaries += tmp_ret[1]
hiddenimports += tmp_ret[2]

a = Analysis(
    ['demo.py'],
    pathex=['D:\\Pycham\\Python\\nn\\src\\nn-screen-refresh'],
    binaries=binaries,
    datas=datas,
    hiddenimports=hiddenimports,
    hookspath=['hooks'],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    noarchive=False,
    optimize=0,
)

pyz = PYZ(a.pure)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='demo',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=False,  # 设置为 False 以生成无控制台的可执行文件
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
   